/*
 * Test to Brain.java
 * 15.06.2012
 */
package HumanTests;

import static org.junit.Assert.*;
import human.Brain;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests to Brain.java
 * 
 * @author Vasyl Khyzhniak
 * @version 1.0
 */
public class BrainTest {

	Brain brainTest;
	@Before
	public void setUp() {
		brainTest = new Brain();	
	}
	
	@Test
	public void shouldBeCorrectHealthWhenBrainCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,brainTest.getHealth());
	}
	
	@Test
	public void shouldBeCorrectFatigueWhenBrainCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,brainTest.getFatigue());
	}

	@Test
	public void shouldBeCorrectMemoryWhenBrainCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,brainTest.getMemory());
	}
	
	@Test
	public void shouldBeCorrectOxygenationWhenBrainCreated() {
		//given
		
		//when
		
		//then
		assertEquals(0,brainTest.getOxygenation());
	}
	
	@Test
	public void shouldBeNecessaryForLifeWhenBrainCreated() {
		//given
		
		//when
		
		//then
		assertEquals(true,brainTest.getLifeImportance());
	}
	
	@Test
	public void shouldBeModifiedFatigueWhenChanging() {
		//given
		
		//when
		brainTest.changeFatigue(15);
		//then
		assertEquals(15,brainTest.getFatigue());
	}

	@Test
	public void shouldBeModifiedMemoryWhenChanging() {
		//given
		
		//when
		brainTest.changeMemory(15);
		//then
		assertEquals(15,brainTest.getMemory());
	}
	
	@Test
	public void shouldBeModifiedOxygenationhWhenChanging() {
		//given
		
		//when
		brainTest.changeOxygenation(15);
		//then
		assertEquals(15,brainTest.getOxygenation());
	}
	
	@Test
	public void shouldControlLowerLimitWhenFatigueModified() {
		//given
		
		//when
		brainTest.changeFatigue(brainTest.getLowerLimit() - 10);
		//then
		assertEquals(brainTest.getLowerLimit(),brainTest.getFatigue());
	}
	
	@Test
	public void shouldControlLowerLimitWhenMemoryModified() {
		//given
		
		//when
		brainTest.changeMemory(brainTest.getLowerLimit() - 10);
		//then
		assertEquals(brainTest.getLowerLimit(),brainTest.getMemory());
	}
	
	@Test
	public void shouldControlLowerLimitWhenOxygenationModified() {
		//given
		
		//when
		brainTest.changeOxygenation(brainTest.getLowerLimit() - 10);
		//then
		assertEquals(brainTest.getLowerLimit(),brainTest.getOxygenation());
	}
	
	@Test
	public void shouldControlUpperLimitWhenFatigueModified() {
		//given
		
		//when
		brainTest.changeFatigue(brainTest.getUpperLimit() + 10);
		//then
		assertEquals(brainTest.getUpperLimit(),brainTest.getFatigue());
	}
	
	@Test
	public void shouldControlUpperLimitWhenMemoryModified() {
		//given
		
		//when
		brainTest.changeMemory(brainTest.getUpperLimit() + 10);
		//then
		assertEquals(brainTest.getUpperLimit(),brainTest.getMemory());
	}
	
	@Test
	public void shouldControlUpperLimitWhenOxygenationModified() {
		//given
		
		//when
		brainTest.changeOxygenation(brainTest.getUpperLimit() + 10);
		//then
		assertEquals(brainTest.getUpperLimit(),brainTest.getOxygenation());
	}

}
